< previous page page_744 next page >

Page 744
Continued
Listing 33.1
    Else
        WebBrowser1.Visible = True
        tmrMain.Enabled = False
    End If

End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    
    lstStatus.AddItem "Document display completed."

End Sub
Launching the Browser from Your Application
In addition to using the WebBrowser control, you can launch the Web browser as a separate program. This allows the user more freedom because he can resize the browser window and use all of its built-in features. An additional advantage is that you do not have to take up screen real estate on your own forms with an embedded browser control.
Creating an Internet Shortcut
The first step to launching Web sites from an application is to understand the simple concept of an URL (Uniform Resource Locator) file, also known as an Internet shortcut. Internet shortcuts are like regular Windows shortcuts, but they point to a Web site rather than an executable file. Double-clicking an Internet shortcut opens your browser and navigates to the Web site represented by the shortcut.
An Internet shortcut is just a plain text file (actually it's an INI file) containing the URL of the Web site. The structure is as follows:
[InternetShortcut]
URL=http://www.que.com/
The Favorites list in Microsoft Internet Explorer is actually just a bunch of URL files. If you find the Favorites directory on your hard drive, you should be able to see these .URL files. Because the structure of a URL file is so simple, it is very easy to create one from Visual Basic. You can use the INI file functions discussed in Chapter 21, ''Working with Files," or just create a standard text file:
Open "C:\TEMP.URL" For Output As #1
Print #1, "[InternetShortcut]"
Print #1, "URL=http://www.somewhere.com"
Close #1
These four lines of code create an Internet shortcut called TEMP.URL. After it's created, you should be able to click the shortcut icon to launch a Web site.
sarrow.gifSee "Using INI Files," p. xxx (Ch 21)

 
< previous page page_744 next page >